﻿@using Yyyg.WebUI.Models;
@using Yyyg.Models;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    ReceInfo[] rece = ViewBag.Rece;
    //ReceInfo[] rece = { };
    ReceInfo def =  rece.FirstOrDefault(r => r.IsDefault);
    if (def == null) { def = new ReceInfo(); }
    string sum = Model.Sum(s => s.ByCount).ToString("#0.00");
}
    @model List<ByItem>
@section head{
    <title>订单确认</title>
    <link href="~/Content/paypage.css?@Tools.GetRandMax()" rel="stylesheet" />
    <script src="~/Scripts/src/payindex.js?v=2105051641"></script>
}
@RenderPage("~/Views/Shared/TopToolbar.cshtml")
<div class="header pad150">
    <div class="topb">
        <div class="logobox">
            <a href="/"><img src="~/Content/Images/logo.png" /></a>
        </div>
        <ul class="lcul">
            <li>
                <div class="flb">
                    <div class="sel brad">
                        <span>1</span>
                    </div>
                    <p>拍下商品</p>
                </div>
            </li>
            <li>
                <div class="flb">
                    <div class="brad">
                        <span>2</span>
                    </div>
                    <p>付款到平台</p>
                </div>
            </li>
            <li>
                <div class="flb">
                    <div class="brad">
                        <span>3</span>
                    </div>
                    <p>
                        等待开奖
                    </p>
                </div>
            </li>
            <li style="border-style:none">
                <div class="flb">
                    <div class="brad">
                        <span>4</span>
                    </div>
                    <p>开始发货</p>
                </div>
            </li>
        </ul>
    </div>
</div>
<div id="paysection" class="section pad150">
    <div class="shdz">
        <h2>选择收货地址</h2>
        <div class="list">
            @for (int i = 0; i < rece.Length; i++)
            {
                var rec = rece[i];
                <div class="item @(rec.IsDefault?"sel":"")" data-reid="@rec.Id" data-proe="@rec.Proe" data-city="@rec.City" data-area="@rec.Area" data-det="@rec.Det" data-mob="@rec.Mobile" data-cons="@rec.Consianee">
                    <h3>
                        <span class="pc">@(rec.Proe.Trim('省')+rec.City.Trim('市'))</span>
                        &nbsp; (<span class="shr">@(rec.Consianee)收</span>)
                    </h3>
                    <div class="det">
                        @(rec.Area+" "+rec.Det+"  "+rec.Mobile)
                    </div>
                    <div><a href="#">修改</a></div>
                </div>
            }
        </div>
        <div class="btns">
            <button class="layui-btn layui-btn-sm iconfont icon-tianjia" id="use-newaddr">使用新地址</button>
            <a id="addr-mmt" href="/UserInfo/Addr">管理收货地址</a>
        </div>
    </div>
    <div class="ddxx">
        <h2>确认订单信息</h2>
        <div>
            <table id="paytb">
                <tr>
                    <th>商品图片</th>
                    <th>商品标题</th>
                    <th>剩余人次</th>
                    <th>单价</th>
                    <th>参与人次</th>
                    <th>小计</th>
                </tr>
                @for (int i = 0; i < Model.Count; i++)
                {
                    ByItem item = Model[i];
                    <tr class="rhitem" data-rhid="@item.RushInfo.Id">
                        <td class="tr-img">
                            <a href="/home/goodabout?rhid=@item.RushInfo.Id">
                                <img src="@item.Good.GetMainImgPath()" />
                            </a>
                        </td>
                        <td class="tr-tit">
                            @item.Good.Title
                        </td>
                        <td class="tr-rem">@(item.RushInfo.Rem)人次</td>
                        <td class="tr-pric">￥<span class="pric">1.00</span></td>
                        <td class="tr-join">
                            <div class="input-nud">
                                <button>-</button>
                                <input value="@(item.ByCount)" min="1" max="@item.RushInfo.Rem" type="number" />
                                <button>+</button>
                            </div>
                        </td>
                        <td class="tr-sum">￥@(item.ByCount.ToString("#0.00"))</td>
                    </tr>
                }
            </table>
        </div>
    </div>
    <div class="tj">
        <div class="tjbox">
            <div>
                <p class="p1">
                    <span class="bet">实付款:</span>
                    <span>￥</span>
                    <span id="sumpric">@sum</span>
                </p>
                <p class="p2">
                    <span class="bet">中奖送寄至:</span>
                    <span id="zjsz">@(string.Format("{0} {1} {2}{3}",def.Proe,def.City,def.Area,def.Det))</span>
                </p>
                <p class="p3">
                    <span class="bet">收货人:</span>
                    <span id="shr">@(def.Consianee+"  "+def.Mobile)</span>
                </p>
            </div>
        </div>
        <div>
            <button id="submit" class="">提交订单</button>
        </div>
    </div>
</div>
<div class="footer">
    @RenderPage("~/Views/Shared/Foolter.cshtml")
</div>


